FULL R SCRIPT


nes<-read.csv("anes2008.csv")
summary(nes$age)
summary(nes$cfundamentals)
hist(nes$military)
hist(nes$blacks)
boxplot(nes$asians)
cor(nes$age, nes$christian, use="complete.obs")
install.packages("car") #select CRAN mirror 75 before continuing
library(car)
scatterplot(nes$bigbiz, nes$richppl)
scatterplot(nes$midclass, nes$poorppl)
install.packages("wvioplot") #select CRAN mirror 75 before continuing
library(wvioplot)
wvioplot(nes$cfundamentals)



EXPLANATION OF R SCRIPT

nes<-read.csv("anes2008.csv")
#reads the table

summary(nes$age)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
18.00 33.00 47.00 47.37 59.00 93.00 45

summary(nes$cfundamentals)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
0.00 50.00 60.00 59.18 70.00 100.00 436

#minimum, minimum response number
#first quartile, cuts off the first 25% of the recorded data
#median, middle number of the recorded data
#mean, add the numbers up and divide by the number of responses
#third quartile, cuts off at 75% of the recorded data
#maximum, highest response number



HISTMIL.pnghist(nes$military)
HISTBLACKS].pnghist(nes$blacks)
#frequency of each numbered response
BOXAZNZ.pngboxplot(nes$asians)
#whisker at the bottom is the minimum
#bottom line of box is the first quartile
#bold line in the middle is the median
#top line of the box is the third quartile
#whisker at the top is the maximum


cor(nes$age, nes$christian, use="complete.obs")
[1] 0.1239193
#positive numbers means that as one goes up, the other goes up
#negative numbers mean that as one goes up the other goes down
#this was a positive number, therefore as positive feelings about christians go , positive feelings about cfundamentals goes up.


install.packages("car") #select CRAN mirror 75 before continuing
library(car)

#each point represents what one respondent recorded for each variable
SPLOTBIGBIZ.pngscatterplot($bigbiz, nes$richppl)
  1. X-axis is bigbiz, Y-axis is richppl
#positive correlation, as good feelings about big business, go up, so good feelings about rich people go up

SPLOTMIDCLASS.pngscatterplot($midclass, nes$poorppl)
  1. X-axis is midclass, Y-axis is poorppl
#as feelings about the midclass go up, feelings about poorppl go up


install.packages("wvioplot") #select CRAN mirror 75 before continuing
library(wvioplot)
WVIOCFUND.pngwvioplot(nes$cfundamentals)
#plot gets wider at more frequent responses, and thinner at less frequent responses

(Jinx, this is solid work. Good job. Only thing I'd say is that this type of presentation, using hashtags to annotate the R script, is not the best here. It's OK, but you want to present your results as if you're offering the world a research report. People may or may not know what this code means. So only give them the graphs and the numerical ouput! And explain/discuss that. Use full sentences and paragraphs and real punctuation and all that. The code (with annotations) is excellent, but that should be contained in a file that users can download and explore only if they wish to, as a supplement to the research report. Sound good?)